package com.elmcode.server.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.elmcode.server.properties.AliPayProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class PayConfig {

    @Resource
    AliPayProperties aliPayProperties;

    @Bean
    public AlipayClient alipayClient(){
        return new DefaultAlipayClient(aliPayProperties.getGatewayUrl(), aliPayProperties.getAppId(), aliPayProperties.getMerchantPrivateKey(),
                "json", "utf-8", aliPayProperties.getAlipayPublicKey(), aliPayProperties.getSignType());
    }




}
